<!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>我的</title>
    <link rel="stylesheet" type="text/css" href="../css/api.css" />
    <link rel="stylesheet" type="text/css" href="../css/style.css" />
    <link rel="stylesheet" type="text/css" href="../css/swiper.min.css" />
    <link rel="stylesheet" type="text/css" href="../css/layer.css" />
    <link rel="stylesheet" type="text/css" href="../css/mdw.css" />
    <script type="text/javascript" src="../script/api.js"></script>
    <script type="text/javascript" src="../script/jquery-1.9.1.min.js"></script>
    <script type="text/javascript" src="../script/swiper.min.js"></script>
    <script type="text/javascript" src="../script/mobile.js"></script>
    <script type="text/javascript" src="../script/layer.js"></script>
    <script type="text/javascript" src="../script/mdw.js"></script>
    <script type="text/javascript" src="../script/jumpPage.js"></script>

</head>
<body>
    <section class="memberInfo">
        <div class="memberBackground">
            <img src="../image/bg.png" />
        </div>
        <div class="memberHeard">
            <!-- newMsg class有on时 为有新消息 -->
            <div class="message" onclick="openWin('message','message.html')"><div class="newMsg "></div></div>
        </div>
        <div class="memUserInfo">
            <div class="memUser">
                <div onclick="openWin('member_info','member_info.html')" class="memTx">
                    <img src="../image/tx.png" />
                </div>
                <div class="userBox">
                    <div class="uname vip"><span></span><i></i></div>
                    <div class="uphone"></div>
                    <div class="personalData" onclick="openWin('member_info','member_info.html')"><i></i>个人资料<i></i></div>
                </div>
            </div>
            <ul class="memQuan">
                <li onclick="openWin('member_integral','member_integral.html')">
                    <span id="score" class="count">0</span>
                    <span class="tit">积分</span>
                    <span class="borderR"></span>
                </li>
                <li onclick="openWin('member_coupon','member_coupon.html')">
                    <span id="coupon" class="count">0</span>
                    <span class="tit">优惠券</span>
                    <span class="borderR"></span>
                </li>
                <li onclick="openWin('member_favorite','member_favorite.html')">
                    <span id="faviorite" class="count">0</span>
                    <span class="tit">收藏夹</span>
                </li>
            </ul>
        </div>
    </section>
    <section class="memberPage">
        <div class="order_tit">
            <div >我的订单</div>
            <div onclick="goOrder(0);" class="right_icon">查看全部<i></i></div>
        </div>
        <ul class="orderBox">
            <li onclick="goOrder(1);"><i><div class="msgCount"></div></i><span>待付款</span></li>
            <li onclick="goOrder(2);"><i><div class="msgCount"></div></i><span>待发货</span></li>
            <li onclick="goOrder(3);"><i><div class="msgCount"></div></i><span>待收货</span></li>
            <li onclick="goOrder(4);"><i><div class="msgCount"></div></i><span>待评价</span></li>
            <li onclick="openWin('groupBuy_order','groupBuy_order.html')"><i><div class="msgCount"></div></i><span>拼团</span></li>
        </ul>
        <div class="bg-eee" style="border-bottom:.2rem solid #EEE ; "></div>
        <ul class="functionBox">
            <li onclick="openWin('address','address.html')"><i class="icon">我的地址</i><i class="backIcon"></i></li>
            <li onclick="openWin('bankCard','bankCard.html')"><i class="icon">我的银行卡</i><i class="backIcon"></i></li>
            <li onclick="openWin('member_evaluate','member_evaluate.html')"><i class="icon">我的评价</i><i class="backIcon"></i></li>
            <li onclick="openWin('help','help.html')"><i class="icon">帮助中心</i><i class="backIcon"></i></li>
            <li onclick="openWin('setting','setting.html')"><i class="icon">设置</i><i class="backIcon"></i></li>
        </ul>
        <div class="bg-eee" style="border-bottom:.2rem solid #EEE ; "></div>
    </section>
    <!-- 底部导航 -->
    <!-- <section class="sectionH"></section> -->
    <section class="navigation">
    <ul>
        <li onclick="openWin('index','index.html')">
            <span class="icon"></span>
            <p id="nav1">首页</p>
        </li>
        <li onclick="openWin('classify','classify.html')">
            <span class="icon"></span>
            <p id="nav2">分类</p>
        </li>
        <li onclick="openWin('groupBuy','groupBuy.html')">
            <span class="icon"></span>
            <p id="nav3">拼团</p>
        </li>
        <li  onclick="shoppingCart()">
            <span class="icon"></span>
            <p id="nav4">购物车</p>
        </li>
        <li class="on" onclick="member()">
            <span class="icon"></span>
            <p id="nav5">我的</p>
        </li>
    </ul>
</section>

</body>
<script type="text/javascript" src="../script/api.js"></script>
<script type="text/javascript">
    apiready = function(){
        $api.fixStatusBar($api.dom('.memberInfo'));
        api.setStatusBarStyle({
            color: '#fff',//设置APP状态栏背景色
            style: 'dark'
        });
        //兑换优惠券后回调
        api.addEventListener({
            name: 'duihuanyhq'
        }, function(ret, err) {
           ready();
        });
        ExitApp();
        $(".memTx img").hide();
        ifCnAndEn();
        ready();
    };
    function ready(){
        pop.loading();
        getAjax(Interface.member_info,{token:token},function(res){
            var data = res.data.info;
            console.log(JSON.stringify(res.data.info));
            var count = res.data.count;
            $(".uname span").html(data.username);//名字
            if(data.mobile == null || data.mobile ==""){
                if(data.email == null || data.email ==""){
                     $(".uphone").html("");//电话
                }else{
                    $(".uphone").html(data.email);
                }
            }else{
                if(data.mobile.length == 11){
                    var mobile = data.mobile.substr(0,3)+"****"+data.mobile.substr(7);
                    $(".uphone").html(mobile);//电话
                }else{
                    $(".uphone").html(data.mobile);//电话
                }
            }
            $("#score").html(data.score);//积分
            
            $(".memTx img").attr("src",getImg(data.icon)).show();
            if(count.nopay_order !=0){
                $(".orderBox li").eq(0).addClass("on").find(".msgCount").html(count.nopay_order);
            }
            if(count.nosend_order !=0){
                $(".orderBox li").eq(1).addClass("on").find(".msgCount").html(count.nosend_order);
            }
            if(count.noaccept_order !=0){
                $(".orderBox li").eq(2).addClass("on").find(".msgCount").html(count.noaccept_order);
            }
            if(count.no_comment !=0){
                $(".orderBox li").eq(3).addClass("on").find(".msgCount").html(count.no_comment);
            }
            if(count.spell_order !=0){
                $(".orderBox li").eq(4).addClass("on").find(".msgCount").html(count.spell_order);
            }
            
            $("#coupon").html(count.use_coupon);//积分
            $("#faviorite").html(count.collect_count);//积分
            if(count.member_massage_count > 0){
                $(".newMsg").addClass("on");
            }
            pop.close();
            
        },function(err){
            alert(JSON.stringify(err));
        })
    }
</script>
<script type="text/javascript">
    function ifCnAndEn(){
        if(cnen==2){
            $("#nav1").html('Home');
            $("#nav2").html('Departments');
            $("#nav3").html('Deals');
            $("#nav4").html('Cart');
            $("#nav5").html('Account');
            $(".memQuan .tit").eq(0).html('Points Balance');//积分
            $(".memQuan .tit").eq(1).html('Coupons');//积分
            $(".memQuan .tit").eq(2).html('Wish List');//积分
            $(".order_tit div").eq(0).html('My Order');
            $(".order_tit div").eq(1).html('All orders<i></i>');
            $(".personalData").html('<i></i>My Account<i></i>');
            $(".orderBox li").eq(0).find("span").html('Unpaid');
            $(".orderBox li").eq(1).find("span").html('Processing');
            $(".orderBox li").eq(2).find("span").html('Shipped');
            $(".orderBox li").eq(3).find("span").html('For Review');
            $(".orderBox li").eq(4).find("span").html('Group Buy');
            $(".functionBox li").eq(0).find(".icon").html('My Address');
            $(".functionBox li").eq(1).find(".icon").html('My Bank Card');
            $(".functionBox li").eq(2).find(".icon").html('My Reviews');
            $(".functionBox li").eq(3).find(".icon").html('Help');
            $(".functionBox li").eq(4).find(".icon").html('Personal Setting');
        }
    }
</script>

</html>